<template>
<div class="user">

    <van-row class="user-poster">
        <van-col span="6" offset="2">
            <van-image round width="60" height="60" src="user.avatar" />
        </van-col>
        <van-col span="14" offset="2">
            <div style="padding-top:25px;">
                {{user.nickName}}
            </div>
        </van-col>
    </van-row>

    <van-row>
        <van-grid>
            <van-grid-item icon="orders-o" text="全部订单" @click="toOrder(0)" />
            <van-grid-item icon="pending-payment" text="待付款" @click="toOrder(1)" />
            <van-grid-item icon="pending-payment" text="待发货" @click="toOrder(2)" />
            <van-grid-item icon="free-postage" text="待收货" @click="toOrder(3)" />
            <van-grid-item icon="bag-o" text="已完成" @click="toOrder(4)" />
        </van-grid>
    </van-row>

    <van-divider />

    <van-cell-group>
        <van-cell icon="location-o" title="收货地址" is-link @click="toAddress" />

        <van-cell icon="points" title="我的收藏" is-link @click="toFavorite" />

        <!--<van-cell icon="gold-coin-o" title="我的优惠券" is-link />

        <van-cell icon="gift-o" title="我收到的礼物" is-link />-->

        <van-cell icon="warning-o" title="关于" is-link @click="toAbout" />
    </van-cell-group>
</div>
</template>

<script>
// Use Vuex
import store from '@/utils/store.js'

export default {
    config: {
        navigationBarTitleText: '个人中心'
    },
    data() {
        return {}
    },
    computed: {
        user() {
            return store.state.user
        }
    },
    methods: {
        toOrder(status) {
            const url = '../../order/index?status=' + status
            wx.navigateTo({
                url
            })
        },
        toAddress() {
            const url = '/pages/address/index'
            wx.navigateTo({
                url
            })
        },
        toAbout() {
            const url = '/pages/profile/about/index'
            wx.navigateTo({
                url
            })
        },
        toFavorite() {
            const url = '/pages/profile/favorite/index'
            wx.navigateTo({
                url
            })
        }

    }
}
</script>

<style>
body {
    background-color: #FFFFFF
}

.user-poster {
    width: 100%;
    height: 60px;
}

.user-poster>.van-row {
    padding: 5px;
    background-color: #87CEFA;
}

.user-links {
    padding: 15px;
    text-align: center;
    background-color: #fff;
}
</style>
